package spaces;

import vectors.Direction;
import vectors.Location;
import vectors.Vector;

public class DirectionNode extends Node implements Comparable<DirectionNode>{
	
	public DirectionNode(String name){
		super(name);
	}
	
	public DirectionNode(String name, Direction dir){
		super(name, dir);
	}
	
	public Direction getDir(){
		return (Direction)location;
	}
	
	public void setDir(Direction dir){
		location = dir;
	}
	
	@Override
	public Direction getLocation() {
		return (Direction)location;
	}

	@Override
	public void setLocation(Location location) {
		if(location instanceof Direction){
			this.location = location;
		} else {
			throw new IllegalArgumentException("Must give Direction, not any Location.");
		}
	}

	public String getName() {
		return name;
	}
	
	@Override
	public int compareTo(DirectionNode node) {
		return name.compareTo(node.getName());
	}
	
	public boolean equals(Object node){
		if(node instanceof DirectionNode){
			return compareTo((DirectionNode)node) == 0;
		} else {
			return super.equals(node);
		}
	}
}
